<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRiskRuleAliTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('risk_rule_ali', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('zhfx',50)->nullable()->comment('综合风险');
            $table->string('gzfx',50)->nullable()->comment('共租风险');
            $table->string('yqfx',50)->nullable()->comment('逾期风险');
            $table->smallInteger('status')->nullable()->comment('状态');
            $table->string('level',50)->nullable()->comment('等级');
            $table->timestamps();
        });

        Schema::table('risk_order', function (Blueprint $table) {
            $table->integer('dengji_ali')->default(0)->nullable()->default(0)->comment('智租等级');
            $table->integer('rule_ali_id')->nullable()->default(0)->comment('规则ID');
            $table->smallInteger('is_curtail')->nullable()->default(0)->comment('缩减接口 1缩减成功 9缩减失败');
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('risk_rule_ali');

        Schema::table('risk_order', function (Blueprint $table) {
            $table->dropColumn(['dengji_ali','rule_ali_id','is_curtail']);
        });
    }
}
